package com.mywang.weitravel.modules.study;

import android.widget.ImageView;
import android.widget.TextView;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.mywang.weitravel.R;
import com.mywang.weitravel.adapter.StudyListAdapter;
import com.mywang.weitravel.base.BaseActivity;
import com.mywang.weitravel.model.StudyBean;
import com.mywang.weitravel.model.StudyDetailBean;

import java.util.List;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by wangmingyun on 2019/12/11.
 */
public class StudyTravelActivity extends BaseActivity<StudyPresenter> implements StudyContract.View {

    @BindView(R.id.iv_title_back)
    ImageView ivTitleBack;
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.rv_study_list)
    RecyclerView rvStudyList;
    StudyListAdapter studyListAdapter;

    @Override
    protected void initView() {
        tvTitle.setText("研学旅行");
        rvStudyList.setLayoutManager(new LinearLayoutManager(this));
        mPresenter.getData();
    }

    @Override
    protected StudyPresenter initPresenter() {
        return new StudyPresenter(this);
    }

    @Override
    protected int getActivityLayoutID() {
        return R.layout.activity_study_travel;
    }

    @Override
    public void onSuccess(List<StudyBean> list) {
        studyListAdapter = new StudyListAdapter(this, list);
        rvStudyList.setAdapter(studyListAdapter);
    }

    @Override
    public void onDetailSuccess(StudyDetailBean bean) {

    }

    @OnClick(R.id.iv_title_back)
    public void onViewClicked() {
        finish();
    }
}
